<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 商城管理 <span class="c-gray en">&gt;</span> 商品分类管理<span class="c-gray en">&gt;</span> 商品分类添加</nav>
	<div id="sectionContent" class="Hui-article">
		<article class="page-container">
			<div class="form form-horizontal" id="form-admin-add">
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>分类名称：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" id="classificationName">
					</div>
				</div>
        <div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>ICON：</label>
					<div class="formControls col-xs-8 col-sm-9">
            <div><img src="http://p3cxjq83j.bkt.clouddn.com/pic_not_found.png" width="80" height="80" id="classificationIconShow" style="border:1px solid #ccc;margin:10px;" accept="image/*"/></div>
						<input type="file" class="input-text" onchange="checkField($('#classificationIconShow'),$('#classificationIcon'),this.files[0])">
            <input type="hidden" id="classificationIcon" value="http://p3cxjq83j.bkt.clouddn.com/pic_not_found.png"/>
					</div>
				</div>
        <div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>排列顺序：</label>
					<div class="formControls col-xs-8 col-sm-9">
						<input type="text" class="input-text" id="classificationOrder" value="1">
					</div>
				</div>
				<div class="row cl">
					<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
						<input class="btn btn-primary" type="button" v-on:click="saveData()" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" style="margin-right:30px;">
						<input class="btn" type="button" onclick="javascript:history.go(-1)" value="&nbsp;&nbsp;取消&nbsp;&nbsp;">
					</div>
				</div>
			</div>
		</article>
	</div>
	<script>
    new Vue({
        el:'#sectionContent',
        http: authorization(),
        methods:{
            backToList:function(){
                window.parent.location.href="#!view/shopping/classification/classification-list.html?"+Math.random();
            },
            saveData:function(){
                var formData = {
                    classificationName:$('#classificationName').val(),
                    classificationIcon:$('#classificationIcon').val(),
                    classificationOrder:$('#classificationOrder').val()
                };
                this.$http.post('/restful/shopping/v1.0/classification',formData).then((response) => {
                    this.backToList();
                }).catch(function(response) {
                    alert(errorMsg(response));
                });
            }
        }
    });
</script>
